<?php
/**
 * 消息管理
 */
namespace app\modules\user\controllers;

use app\modules\app\models\UserPlan;
use app\modules\user\models\MockUser;
use app\modules\user\models\News;
use app\modules\user\models\User;
use yii;
use app\libs\ApiControl;
use app\libs\Method;

class PlanController extends ApiControl
{
    public $enableCsrfValidation = false;
    public $layout = 'user';

    /**
     * [actionIndex 系统消息列表]
     * @Author yoyo
     * @Date   2023-04-28
     */
    public function actionIndex()
    {
        $page = Yii::$app->request->get('page', 1);
        $data = UserPlan::find()->asArray()->offset(($page-1)*20)->limit(20)->orderBy('id desc')->all();
        $count = count(UserPlan::find()->asArray()->select('id')->orderBy('id desc')->all());
        $page = Method::getPagedRows(['count' => $count, 'pageSize' => 20, 'rows' => 'models']);
        return $this->render('index', ['page' => $page, 'data' => $data]);
    }
}